#import "SMMoment.h"
#import "SMComment.h"

@implementation SMMoment

#pragma mark - IGListDiffable

- (id<NSObject>)diffIdentifier {
    return self.momentId ?: @"";
}

- (BOOL)isEqualToDiffableObject:(id<IGListDiffable>)object {
    if (self == object) return YES;
    // ✅ 强转为 id，再判断类型
    if (![(id)object isKindOfClass:[SMMoment class]]) return NO;

    SMMoment *o = (SMMoment *)object;
    return [self.momentId isEqualToString:o.momentId]
        && self.likesCount == o.likesCount
        && self.isLiked == o.isLiked
        && self.isExpanded == o.isExpanded
        && (self.comments.count == o.comments.count)
        && ((self.text ?: @"").hash == (o.text ?: @"").hash)
        && (self.imageURLs.count == o.imageURLs.count);
}

@end
